﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Customers
    </h2>
        <asp:EntityDataSource ID="EntityDataSourceCusts" runat="server" 
            ConnectionString="name=NorthwndEntitiesCnn" 
            DefaultContainerName="NorthwndEntitiesCnn" EnableFlattening="False" 
            EntitySetName="Customers" 
            AutoPage="true"
            AutoSort="true"
            OrderBy="it.CompanyName"
            
        Select="it.[CustomerID], it.[CompanyName], it.[City], it.[Region], it.[Country], it.[Phone]">
        </asp:EntityDataSource>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="EntityDataSourceCusts" AllowPaging="True" 
        AllowSorting="True" Width="447px">
            <Columns>
                <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True" 
                    SortExpression="CustomerID" />
                <asp:BoundField DataField="CompanyName" HeaderText="Company" 
                    ReadOnly="True" SortExpression="CompanyName" />
                <asp:BoundField DataField="City" HeaderText="City" ReadOnly="True" 
                    SortExpression="City" />
                <asp:BoundField DataField="Region" HeaderText="Region" ReadOnly="True" 
                    SortExpression="Region" />
                <asp:BoundField DataField="Country" HeaderText="Country" ReadOnly="True" 
                    SortExpression="Country" />
                <asp:BoundField DataField="Phone" HeaderText="Phone" ReadOnly="True" 
                    SortExpression="Phone" />
                <asp:HyperLinkField DataNavigateUrlFields="CustomerId" 
                    DataNavigateUrlFormatString="orders.aspx?custId={0}" HeaderText="Orders" 
                    Text="view orders" />
            </Columns>
        </asp:GridView>

</asp:Content>
